#include "templateplugin.h"
#include <QDebug>
#include <QMessageBox>

templatePlugin::templatePlugin(int tourId, QObject *parent) :
    QObject(parent),
    _tour(tourId)
{
}

void templatePlugin::setActive(bool active)
{
    flag_activ = active;
    if (active) emit activated(); else emit closed();
}

bool templatePlugin::isActive()
{
    return flag_activ;
}

bool templatePlugin::buildDatabase(QSqlDatabase *dbase)
{
    dbase->isOpen();
    QMessageBox::information(0,
                             tr("Plugin information"),
                             tr("current plugin not implict this function"),
                             QMessageBox::Close, QMessageBox::Close);
    return false;
}

void templatePlugin::pluginInfo(QString &vrvs_name, QString &vrvs_code, QString &plug_version)
{
    QString name = tr("No name"),
            code = tr("Code undefined"),
            version = tr("Develop version");
    vrvs_name = name;
    vrvs_code = code;
    plug_version = version;
}

bool templatePlugin::testDatabaseStructure(QSqlDatabase *db)
{
    qWarning() << "test db structure not implicted";
    return db->isOpen();
}

int templatePlugin::tour()
{
    return _tour;
}

void templatePlugin::setTour(int tourId)
{
    _tour = tourId;
}
